import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class ChecksumCalculator {
    public static String calcChecksum(byte[] data, int offset, int len) {
        MessageDigest md = null;
        try {
            md = MessageDigest.getInstance("SHA-256");
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        md.update(data, offset, len);
        String s = new BigInteger(1, md.digest()).toString(16);
//        s = s.substring(0, 6);
//        s += ".txt";
        return s;
    }
}
